<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/**
 *
 * header-extensions.php template file
 *
 * (c) 2011 by Mike Walsh
 *
 * @author Mike Walsh <mike@walshcrew.com>
 * @package ms-hs-booster-club
 * @subpackage functions
 * @version $Revision$
 * @lastmodified $Author$
 * @lastmodifiedby $Date$
 *
 */

require_once('theme-options.inc.php') ;

/**
 * mshsbc_header_images()
 *
 * Build a customer header based on saved theme options.
 *
 */
function mshsbc_header_images($theme_options = array())
{
    //var_dump($theme_options) ;
    //error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
?>
<div id="mshsbchdr" style="<?php echo $theme_options[MSHSBC_THEME_OPTION_HDR_DIV_CSS]; ?>">

<!--  Handle the left header image -->
<div id="mshsbclfthdrimg" style="<?php echo $theme_options[MSHSBC_THEME_OPTION_HIL_DIV_CSS]; ?>">
<?php

if (!empty($theme_options[MSHSBC_THEME_OPTION_HIL]))
{
    $lfthdrimg = wp_get_attachment_image_src($theme_options[MSHSBC_THEME_OPTION_HIL], 'full') ;
    
?>
<a href="<?php bloginfo('url'); ?>"><img src="<?php print $lfthdrimg[0] ; ?>" alt="<?php $alt = bloginfo('name') . ' Home' ; print $alt ;?>"></a>
<?php
}
?>
    
</div> <!--  #mshsbclfthdrimg -->

<!--  Handle the right header image -->
<div id="mshsbcrghthdrimg" style="<?php echo $theme_options[MSHSBC_THEME_OPTION_HIR_DIV_CSS]; ?>">
<?php

if (!empty($theme_options[MSHSBC_THEME_OPTION_HIR]))
{
    $rghthdrimg = wp_get_attachment_image_src($theme_options[MSHSBC_THEME_OPTION_HIR], 'full') ;
    
?>
<a href="<?php bloginfo('url'); ?>"><img src="<?php print $rghthdrimg[0] ; ?>" alt="<?php $alt = bloginfo('name') . ' Home' ; print $alt ;?>"></a>
<?php
}
?>
    
</div> <!--  #mshsbcrghthdrimg -->

<!--  Handle the center header image -->
<div id="mshsbcctrhdrimg" style="<?php echo $theme_options[MSHSBC_THEME_OPTION_HIC_DIV_CSS]; ?>">
<?php

if (!empty($theme_options[MSHSBC_THEME_OPTION_HIC]))
{
    $ctrhdrimg = wp_get_attachment_image_src($theme_options[MSHSBC_THEME_OPTION_HIC], 'full') ;
    
?>
<a href="<?php bloginfo('url'); ?>"><img src="<?php print $ctrhdrimg[0] ; ?>" alt="<?php $alt = bloginfo('name') . ' Home' ; print $alt ;?>" style="<?php echo $theme_options[MSHSBC_THEME_OPTION_HIC_IMG_CSS]; ?>"></a>
<?php
}
?>
    
</div> <!--  #mshsbcctrhdrimg -->

</div><!--  #headerimage -->
<?php
}

function mshsbc_blogtitle()
{
    $theme_options = mshsbc_get_theme_options() ;

    //var_dump($theme_options) ;
?>
<h1 style="<?php echo $theme_options[MSHSBC_THEME_OPTION_BLOG_TITLE_CSS]; ?>" id="blog-title"><span><a href="<?php home_url() ?>/" title="<?php echo esc_html( get_bloginfo('name'), 1 ) ?>" rel="home"><?php bloginfo('name') ?></a></span></h1>
<?php
}

function mshsbc_blogdescription()
{
?>
<div style="<?php echo $theme_options[MSHSBC_THEME_OPTION_BLOG_TAGLINE_CSS]; ?>" id="blog-description"><?php bloginfo('description') ?></div>
<?php
}

function mshsbc_brandingopen()
{
    mshsbc_header_images() ;
}

/**  Thematic overrides ... kind of an odd way to do it but this is how it works!  **/

function childtheme_override_brandingopen() {
    $theme_options = get_option('mshsbc_theme_options') ;
?>
<div id="branding" style="<?php echo $theme_options[MSHSBC_THEME_OPTION_BRANDING_DIV_CSS]; ?>">
<?php
    //error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
    mshsbc_header_images($theme_options) ;
}

function childtheme_override_brandingclose() { ?>
</div><!-- #branding -->
<?php }

function childtheme_override_blogtitle() {
    //error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
    mshsbc_blogtitle() ;
}

function childtheme_override_blogdescription() {
    //error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
    mshsbc_blogdescription() ;
}
?>
